//
//  WDCalendarOneDayCell.m
//  teatCalendar
//
//  Created by 解向前 on 2018/3/6.
//  Copyright © 2018年 com.test. All rights reserved.
//

#import "WDCalendarOneDayCell.h"



@interface WDCalendarOneDayCell()

@property (strong, nonatomic) UILabel *dayLable;

@end

@implementation WDCalendarOneDayCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self setupInit];
    }
    return self;
}

- (void)setModel:(WDCalendarCellModel *)model {
    _model = model;
    NSCalendar *calendar = [NSCalendar currentCalendar];
    NSDateComponents *componts = [calendar components:NSCalendarUnitDay fromDate:model.date];
    self.dayLable.text = [NSString stringWithFormat:@"%ld", componts.day];
}

- (void)setupInit {
    // self.backgroundColor = [UIColor whiteColor];
    self.dayLable.frame = CGRectMake(0, 0, 30, 30);
    [self.contentView addSubview:self.dayLable];
}

- (UILabel *)dayLable {
    if (!_dayLable) {
        _dayLable = [[UILabel alloc] init];
        _dayLable.font = [UIFont systemFontOfSize:18];
        _dayLable.textColor = [UIColor darkTextColor];
        _dayLable.backgroundColor = [UIColor whiteColor];
    }
    return _dayLable;
}
@end
